package com.songshuai.webapi.baseapi.enumerations;

public enum DictionaryTypeEnum {

    FirstSource(6009, "来源"),
    DepeartmentLevel(6001, "部门等级"),
    IntendLevel(6007, "意向级别(线下)"),
    FollowStatus(6005, "跟进状态(线下)"),
    Stage(6003, "学段(线下)"),
    Sex(1001, "性别"),
    UserRole(1006, "部门用户角色");
    private int code;
    private String msg;

    DictionaryTypeEnum(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static int getCode(String define){
        try {
            return DictionaryTypeEnum.valueOf(define).code;
        } catch (IllegalArgumentException e) {
            return 0;
        }
    }

    public static String getMsg(String define){
        try {
            return DictionaryTypeEnum.valueOf(define).msg;
        } catch (IllegalArgumentException e) {
            return "";
        }
    }

    public static String getMsg(Integer code){
        if(code==null||code<=0)
            return "";
        for(DictionaryTypeEnum err : DictionaryTypeEnum.values()){
            if(err.code==code){
                return err.msg;
            }
        }
        return "";
    }

    public int getCode(){
        return code;
    }

    public String getMsg(){
        return msg;
    }
}
